I wrote a program that needed to distinguish different kinds of ROMs. I didn't deal with any disk based systems, so I can't help you there. For most ROMs, I just looked for some kind of magic number or standard string. You could go further and start verifying header data, but in my case this didn't seem necessary.
For SNES, there isn't any magic number or standard string that I was aware of. (SMC headers have become much less popular, and if added back on, they may consist of all zeros instead of the correct SMC values.) Instead I verified the internal checksum if the ROM wasn't exceedingly large.
In cases where more than one possible system was identified (or zero), I would disambiguate by file extension. If that failed, I simply asked the user to manually specify the system. But my program only worked on one ROM at a time. If it saves you any trouble,
the utility is here, as well as a link to the source, and includes an HTML file that details platform detection.