I'd suggest reading http://macromates.com/blog/archives/2005/07/06/ introduction-to-scopes/
As for comments, the Toggle Comment command in the Source bundle uses two variables (TM_COMMENT_START/END), these variables are set for misc. scopes (in the bundle editor), so even in an HTML file, it will use proper comment markers in the misc. <style>…</style>,
<script>…</script>, <?php … ?>, <% # ruby %> etc. blocks -- and in
plain HTML, it'll also work.
This however require that you have the language set to HTML (and not PHP, which would make the scope of the entire file source.php).
I've read up on that, thanks. I'm still a bit in the dark here; my file is set to HTML as language, but because the file NAME is ".php", all comments are being made as "#" rather than "<!-- -->", regardless of what the blocks are.