BACKGROUND: Cis-regulatory modules of developmental genes are targets of evolutionary changes that underlie the morphologic diversity of animals. Little is known about the 'grammar' of interactions between transcription factors and cis-regulatory modules and therefore about the molecular mechanisms that underlie changes in these modules, particularly after gene and genome duplications. We investigated the ar-C midline enhancer of sonic hedgehog (shh) orthologs and paralogs from distantly related vertebrate lineages, from fish to human, including the basal vertebrate Latimeria menadoensis. RESULTS: We demonstrate that the sonic hedgehog a (shha) paralogs sonic hedgehog b (tiggy winkle hedgehog; shhb) genes of fishes have a modified ar-C enhancer, which specifies a diverged function at the embryonic midline. We have identified several conserved motifs that are indicative of putative transcription factor binding sites by local alignment of ar-C enhancers of numerous vertebrate sequences. To trace the evolutionary changes among paralog enhancers, phylogenomic reconstruction was carried out and lineage-specific motif changes were identified. The relation between motif composition and observed developmental differences was evaluated through transgenic functional analyses. Altering and exchanging motifs between paralog enhancers resulted in reversal of enhancer specificity in the floor plate and notochord. A model reconstructing enhancer divergence during vertebrate evolution was developed. CONCLUSION: Our model suggests that the identified motifs of the ar-C enhancer function as binary switches that are responsible for specific activity between midline tissues, and that these motifs are adjusted during functional diversification of paralogs. The unraveled motif changes can also account for the complex interpretation of activator and repressor input signals within a single enhancer.