Drupal provides the theming variable $tabs which contains the final HTML output of both the primary and secondary tabs.
Because of this, there's no direct way to theme the primary and secondary tabs separately. However, with a little trick we can split them into two separate variables and make them available to page.tpl.php for your custom theming.