I'm sorry, I didn't fully understand your question at first. In other words, is there something you can do just by looking at a given file to tell if it will "run" on a PostScript interpreter, right?
I'll have to think about that. I don't think so, but let's not be premature! I was able to tell your sample was PostScript because I recognized the PostScript operators. I suppose if you have a list of every PostScript operator, you could write a program to search your file for matches.
Or you can winnow it down to a few assumptions. We could assume that "most" PostScript programs contain at least one definition. So you could search for the "def" operator.
"showpage" would be another good candidate. It's certainly possible for PostScript programs to be fully valid and yet never output a page, but the vast majority will use "showpage".
But that's not a good test, really. Save this message to a file and run your search, and it will find both "def" and "showpage", and yet it isn't PostScript. So you have to have an exclusion test to. If you find a word that isn't an operator and isn't part of a definition, then it isn't PostScript.
The only really valid way is to try to interpret the file. Short of writing your own interpreter, you can use GhostScript, an open source interpreter.
Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting