Coloring files of the same file-type is my favorite feature. Is the extension used to group them or a MIME-header parser? I guess the extension, since it is faster.
This is also part of GNU ls, at least.
man dir_colors
You are right.