Formatters are usually language-specific, and there are formatters for most popular languages. See eg. clang-format [1] for C/C++, your IDE's reformat command for Java [2][3], PythonTidy [4] or AutoPep8 [5] for Python, or jsbeautifier [6], JSPretty [7], or Aptana [8] for JS.
[1] http://clang.llvm.org/docs/ClangFormat.html
[2] http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclips...
[3] https://www.jetbrains.com/idea/webhelp/reformatting-source-c...
[4] https://pypi.python.org/pypi/PythonTidy/1.22