Enzymes are proteins and serve as catalysts in a large number of reactions of importance. They work by lowering the activation energy of a energy. One mechanism of how that happens is by attachment of reactants (or substrates) to specific active sites on these enzymes. This results in formation of an enzyme-substrate complex, which later breaks to give products. The specificity of enzyme is due to these active sites, which contain a number of functional or R-groups. These R-groups are the amino acids. These R-groups contain functional groups such as `NH^+_3` or `COO^-` . They may also be capable of forming hydrogen bonds, due to presence of hydroxyl (`OH^-`) groups. The presence of these groups ensures that only the substrates with a complementary set of groups or capable of forming right bonds will be able to attach to the active site, resulting in specificity of enzymes.
Hope this helps.