poetry.js é um biblioteca que facilita o syntax highlight em páginas web... nos casos obscuros em que gramaticas formais tomariam muito tempo para serem implementadas.
Basta incluir o script poetry.js
na sua página e começar a escrever!
Look at the source!
Dê uma olhada nos arquivos algoritmo.html e demo.html!