The syntax highlighting that you experience in Sublime is a combination of the color scheme that you’re using and the syntax definition that is in use.
So it’s entirely possible that the screen shot you’re looking at is using a syntax definition that knows more specifics about PHP than the one you’re currently using does, or it’s using a color scheme that has more enhanced colors than yours does, or both of those things at the same time.
One reason for that might be that it was taken with a different version of Sublime than the one that you’re currently using, for example.
In any case, probably the bigger issue at the moment is that your code isn’t doing what you expected it to do, because the way that it’s visualized in Sublime is just incidental.
As @kingkeith mentioned, it looks like in your second screen shot that you’re seeing your code when you view the page in the browser, instead of seeing the result of running it. If that’s the case, then your larger issue is that your web server isn’t properly running the code and is instead assuming that it’s a regular file.
I don’t work with PHP but as previously mentioned you should try with the smaller script file to see if that works, and ensure that the extension on the file is .php
so that the server can tell what kind of file it is.