I was trying to create a simple .html file, and was having serious troubles because TextEdit would automatically create and save my file as rich text. I mentioned this to Norbert (creator of the amazing LaunchBar application) and he gave me the following solution:
I recommend using TextEdit for editing and saving html files. You can convert rtf to plain text using the "Make Plain Text" command in TextEdit's Format menu.[Editor's note: This was mentioned in this older hint, but the information it contains is now outdated...]
In order to open HTML files with TextEdit, you must either turn on the "Ignore rich text commands in HTML files" option in the TextEdit Preferences, or select the "Ignore rich text" option in the open panel. Otherwise the html files are rendered instead of showing their html source.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20021025070314853