brew create <url to tarball>
Which, through pure magic, will figure out how to compile the given package and create a brew recipe for you.
It will open up in your editor of choice. Just write the file and then run:
brew install <the name of your package>
And voilà, it’s installed.
I’m told it’s also very easy to fork the project and submit your formulas back to the community using this method, as well. However I haven’t had occasion to do that yet.
See also, the docs. But they don’t mention the magic or the fact that this is actually faster than downloading and compiling it yourself!
Thanks to Brian Dunn for showing me this this morning!