A biofilter was a scanning device that analyzed an incoming transporter matter stream for known biological anomalies. When it detected such anomalies, like viruses, it attempted to remove them from the stream. The transporter operator was always warned of detected anomalies whether or not they were able to be removed. Of note, microbes that existed as both matter and energy could not be distinguished from the matter stream by the biofilter and thus could not be screened out. (TNG: "Realm Of Fear")
While on a survey mission to Surata IV in 2365, the USS Enterprise-D's biofilter detected an unknown microorganism in William T. Riker, but could not filter it out since it had fused itself with his nervous system. (TNG: "Shades of Gray")
Biofilters were also used in replicators. However, it was possible to bypass the biofilter by reprogramming the replicator to build a virus directly into the food it created. This occurred on Deep Space 9 with the aphasia virus developed by Dekon Elig and Surmak Ren, who created a device to introduce instructions on creating the virus into a replicator's pattern generator. (DS9: "Babel")
In 2368, after Deanna Troi, Miles O'Brien, and Data were taken over by Ux-Mal criminals, the biofilter scans showed that their nervous systems were generating high levels of synaptic and anionic energy. (TNG: "Power Play")
The biofilter could be reprogrammed to filter out specific molecular patterns. (TNG: "Realm Of Fear", "Unnatural Selection")
While generally effective, the biofilters were not foolproof. In 2373, the biofilters of the USS Voyager succeeded in isolating the macrovirus that had beamed up with The Doctor from a Garan mining colony. However, in the few seconds that it took him to purge the filters, some of the virus had migrated into the transporter buffers and from there spread throughout the vessel. (VOY: "Macrocosm")
In 2374, The Doctor told Romulan Commander Rekar that he'd checked the biofilters on the bridge of the USS Prometheus for any signs of the Terothka virus. This was an alibi used by The Doctor but was uncovered by Rekar. (VOY: "Message in a Bottle")