Syntax formatting

You know how we use [ as] tags for Actionscript here on this board, and it formats the code’s colors? How would I go about making that a possibility on a web page? If I want to offer up some Actionscript code on my web site, how do I format it like this?

function format(){
trace("I want the color to appear automatically. I'll make the <as> tag if I have to");