It depends both on structure and charge. Binding sites of proteins are essentially formed by amino acids placed in a particular conformations such that it will match the binding site of their counterpart protein or substrate. This is commonly referred to as the lock and key model of protein binding. This is similar to how two puzzle pieces fit together, the pieces are exactly the same shape at the point at which the puzzle pieces connect. At a protein binding site amino acids are clustered together to form the matching shape to the appropriate binding partner. This however is not just dictated by 'physical shape' of each amino acid but also their charges. This is important because negatively charged amino acids will repel other negatively charged amino acids, and attract to positive amino acids, thereby modulating the exact 'shape' of the protein binding site.