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).