SharePoint 2010 (not certain if 2007 has) has new feature named theamable css. This are normal css files, that usually should be placed under 14\TEMPLATE\LAYOUTS\1033\STYLES\Themable\. The only difference is magic /* [ReplaceColor(themeColor:"Dark2")] */ lines. If you go to site theme settings, you can see this settings:

So, what does actually this line mean:
/* [ReplaceColor(themeColor:"Dark2")] */ color:#666666;?
It means, that if you apply theme to your site, your color (#666666) will be dynamically replaced with color, which is currently selected under Dark 2 in particular theme(see screenshot above).
How does it internally work? Every time when you select a theme for site (theme is a .thmx file actually), sharepoint dynamically open .thmx, extracts color and fonts, and then replaces all ReplaceColor-like placeholders with particular color from .thmx. All this parsed css later holds in your site under /_catalogs/theme/Themed/<theme unique id>/<css file>.css (you can verify it using sharepoint manager). When theme is applied, all css files (and even some images) references from this site folder. This is how all this magic works :).
You can also use RecolorImage feature for images, but I don't know exact understand how it works.
Additional info about themeable css:
Leveraging Themable CSS