Proteins need to selectively interact with specific targets among a multitude of similar molecules in the cell. Despite a firm physical understanding of binding interactions, we lack a general theory of how proteins evolve high specificity. Here, we present a model that combines chemistry, mechanics and genetics, and explains how their interplay governs the evolution of specific protein-ligand interactions. The model shows that there are many routes to achieving discrimination - by varying degrees of flexibility and shape/chemistry complementarity - but the key ingredient is precision. Harder discrimination tasks require more collective and precise coaction of structure, forces and movements. Proteins can achieve this through correlated mutations extending far from a binding site, which fine tune the localized interaction with the ligand. Thus, the solution of more complicated tasks is aided by increasing the protein, and proteins become more evolvable and robust when they are larger than the bare minimum required for discrimination. Our model makes testable, specific predictions about the role of flexibility in discrimination, and how to independently tune affinity and specificity. The proposed theory of molecular discrimination addresses the natural question "why are proteins so big?" A possible answer is that molecular discrimination is often a hard task best performed by adding more layers to the protein.