Pygments is a Python packages to syntax highlight more than 300 programming languages and text formats.
This PyGRAZ talk explains the basics of Pygments and then shows to to utilize its API to quickly implement simple source code converters. It also describes how to implements your own lexer.