The main folders you want to back up are:/home/pi/RetroPie (ROMs, BIOS files, splash screens) /opt/retropie/configs (configs for RetroArch, EmulationStation, also your scraped game library) /etc/emulationstation(custom themes as well as the systems ES has access to)
The RetroPie documentation has info on how to copy files. WinSCP or Filezilla are probably the easiest programs to use.
Copy those over from the 3B to the 4, and you should be fine. Note: after you flash the image onto your RPi4, you'll need to boot up with it for RetroPie to finish installing, then you can turn it off and start copying.