A process in which planktonically growing microorganisms grow at a liquid-air interface or on a solid substrate under the flow of a liquid and produce extracellular polymers that facilitate matrix formation, resulting in a change in the organisms' growth rate and gene transcription.