Adding filter to the title without affecting the menu title

Since you’re generating things on the fly, we can use a global flag to let us know when we want the title applied.

add_filter('the_content', function($content){
  if(is_page('compare')){
   global $asin_doing_template;

   // mark that we're doing a template
   $asin_doing_template = true;

   $asin = esc_attr($_GET['asin']);
   $data = get_data($asin);
   $smarty->assign('item_data', $data);
   $content = $smarty->fetch('file.tpl');

   // set it back to false
   $asin_doing_template = false;
  }
  return $content;
});

function zen_title_filter( $title ){
    global $asin_doing_template;

    if( is_singular() && $asin_doing_template ){
        if( $title == 'Product Details Page' || $title == 'Compare Products Page' ){
            $title = zen_get_titles();
        }
    }

    return $title;
}

add_filter( 'the_title', 'zen_title_filter' );

Let me know if that does it!