On Apple TV open the App Store and install iPlayTV or IPTVX. These apps support playlists, EPGs, and automatic iCloud syncing.
Once launched, select Add Playlist → Xtream. Enter the portal URL, login and password. For M3U, upload the file to iCloud Drive → iPlayTV, then select "Import from Files".
To sync your favorites between Apple TV and iPhone, go to the app's Settings → Sync and turn on iCloud. If the stream does not start, check that in Apple TV Settings → Video and Audio → Match Frame Rate is enabled and Proxy/Private Relay mode is disabled.