Antimicrobial peptides and proteins (AMPs) are widespread in the living kingdom. They are key effectors of defense reactions and mediators of competitions between organisms. They are often cationic and amphiphilic, which favors their interactions with the anionic membranes of microorganisms. Several AMP families do not directly alter membrane integrity but rather target conserved components of the bacterial membranes in a process that provides them with potent and specific antimicrobial activities. Thus, lipopolysaccharides (LPS), lipoteichoic acids (LTA) and the peptidoglycan precursor Lipid II are targeted by a broad series of AMPs. Studying the functional diversity of immune effectors tells us about the essential residues involved in AMP mechanism of action. Marine invertebrates have been found to produce a remarkable diversity of AMPs. Molluscan defensins and crustacean anti-LPS factors (ALF) are diverse in terms of amino acid sequence and show contrasted phenotypes in terms of antimicrobial activity. Their activity is directed essentially against Gram-positive or Gram-negative bacteria due to their specific interactions with Lipid II or Lipid A, respectively. Through those interesting examples, we discuss here how sequence diversity generated throughout evolution informs us on residues required for essential molecular interaction at the bacterial membranes and subsequent antibacterial activity. Through the analysis of molecular variants having lost antibacterial activity or shaped novel functions, we also discuss the molecular bases of functional divergence in AMPs. This article is part of a Special Issue entitled: Antimicrobial peptides edited by Karl Lohner and Kai Hilpert.