How to override theme() part in page.tpl.php file?
You can override theme_links__system_secondary_menu() in template.php. You will name it MODULENAME_links__system_secondary_menu(), and the original code can be seen here: https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_links/7.x

Copy that code, and modify it as necessary.