In this video of the tcomment vim plugin we demonstrate the gc operator and automatic recognition of filetypes.
In a HTML paragraph, we type gcip (that is gc + ip for "inner paragraph" to comment this paragraph out (and then again to uncomment it). Since this paragraph contains HTML syntax, tcomment recognizes it as HTML and uses the appropriate markup.
We then use <c-_>b to comment the visually selected paragraph as block.
We try the same with PHP code.