I like the SQLBeautifier plugin for SublimeText. SublimeText is cross-platform (Windows, Linux, and OSX) and has a free trial with unlimited functionality. The plugin itself is free and open source (MIT Licensed). Installation is quite simple - just run installer for SublimeText, open SublimeText and install Package Control, then in Sublime Text type ctrl-shift-p and select Package Control:Install Packages
then select SQLBeautifier.
I've used it and like i,t however it may not be quite what you're looking for so another good option is the back-end behind it; SQLParse python (2 or 3) library. The library is open sourced and free.
If you would prefer a web-app SQLParse is also hosted online. Or if you want an HTTP API that is available as well - free with a 500 requests/hr limit.
All of those will provide the same output (if given the same options that is ofc). It is slightly different than the one you showed:
SELECT FOO,
BAA
FROM BAAFOO
WHERE ID > 10
AND COMMENT = 'John was it';