How does the Twenty Twelve Navigation Bar work?

The code in question is in header.php, line 45.

<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>

This is the Codex reference to this function: wp_nav_menu.

From my experience, and some googling, this previous answer has the answer you’re looking for.

If possible, would just adding a class to the sub-menus do the trick instead of adding a div? If so you should be able to just copy and paste the code from the above linked answer and then target the elements with CSS to get the effect you’re after.