The goal of our research is to elucidate the mechanisms that govern selective filtering by mucus, an important biological hydrogel which coats wet surfaces in the body of all animals. Mucus has critical, but poorly understood, biological functions in protecting tissues from attack by pathogens, and facilitating transport of particulate material. I will present our work on basic mechanisms by which mucus barriers exclude, or allow passage of different molecules and pathogens, and the mechanisms pathogens have evolved to penetrate mucus barriers. We hope to provide the foundation for a theoretical framework that captures general principles governing selectivity in mucus, and likely other biological hydrogels such as the extracellular matrix, and bacterial biofilms. Our work may also be the basis for the reconstitution of synthetic gels that mimic the basic selective properties of biological gel-based barriers.