RNA-binding proteins (RBPs) act as posttranscriptional regulators controlling the fate of target mRNAs. Unraveling how RNAs are recognized by RBPs and in turn are assembled into neuronal RNA granules is therefore key to understanding the underlying mechanism. While RNA sequence elements have been extensively characterized, the functional impact of RNA secondary structures is only recently being explored. Here, we show that Staufen2 binds complex, long-ranged RNA hairpins in the 3′-untranslated region (UTR) of its targets. These structures are involved in the assembly of Staufen2 into RNA granules. Furthermore, we provide direct evidence that a defined Rgs4 RNA duplex regulates Staufen2-dependent RNA localization to distal dendrites. Importantly, disrupting the RNA hairpin impairs the observed effects. Finally, we show that these secondary structures differently affect protein expression in neurons. In conclusion, our data reveal the importance of RNA secondary structure in regulating RNA granule assembly, localization and eventually translation. It is therefore tempting to speculate that secondary structures represent an important code for cells to control the intracellular fate of their mRNAs.