You need to set the UTI then add the new type to "/System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist" for text files or "/Library/Spotlight/SourceCode.mdimporter/Contents/Info.plist" for source files. (NB: SourceCode.mdimporter is installed with the dev tools).
It would be great if the UTIs were set in TextMate. For now I have a dummy "MyUTIs.bundle"[1] in my Applications folder just for that purpose.
[1]: http://geekthang.com/files/MyUTIs.bundle.zip
Unzip in your Applications folder and add new types to "/System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist". CFBundleDocumentTypes should look like this[2].
[2]: http://pastie.textmate.org/18835
You can then check in the Terminal if the type is correct and an mdimporter is found:
$ mdimport -n -d1 "YourFile.markdown" You should see: Import 'YourFile.markdown' type 'public.markdown.plain-text' using 'file://localhost/System/Library/Spotlight/RichText.mdimporter/'
If it's ok, import the folder or file: $ mdimport "path/to/folderorfile"
Check the link below for informations on how to make LaunchService recognize the new UTIs if it doesn't work immediately, etc.
Informations found in this hint[3] AND in the comments.
[3]: http://www.macosxhints.com/article.php?story=2005052015041510