In many bacteria and archaea, small RNAs derived from clustered regularly interspaced short palindromic repeats (CRISPRs) associate with CRISPR-associated (Cas) proteins to target foreign DNA for destruction. In Type I and III CRISPR/Cas systems, the Cas6 family of endoribonucleases generates functional CRISPR-derived RNAs by site-specific cleavage of repeat sequences in precursor transcripts. CRISPR repeats differ widely in both sequence and structure, with varying propensity to form hairpin folds immediately preceding the cleavage site. To investigate the evolution of distinct mechanisms for the recognition of diverse CRISPR repeats by Cas6 enzymes, we determined crystal structures of two Thermus thermophilus Cas6 enzymes both alone and bound to substrate and product RNAs. These structures show how the scaffold common to all Cas6 endonucleases has evolved two binding sites with distinct modes of RNA recognition: one specific for a hairpin fold and the other for a single-stranded 5'-terminal segment preceding the hairpin. These findings explain how divergent Cas6 enzymes have emerged to mediate highly selective pre-CRISPR-derived RNA processing across diverse CRISPR systems.