Formalin is a generic term which describes a solution of 37% formaldehyde gas dissolved in water. It will kill bacteria in your bio-filter, which will lead to ammonia and nitrite spikes.
Formalin is used as a bath treatment to control external parasitic infections of fish. It is extremely effective against most protozoans, as well as some of the larger parasites such as monogenetic trematodes. Formalin effectively kills parasites on gills, skin and fins. It is not the preferred treatment for external bacterial or fungal infections. In addition, high concentrations of formalin are used to control fungi on fish eggs.
Formalin is not effective against internal infections of any type.
For more information, see the following article: http://edis.ifas.ufl.edu/vm061