Refer to Term ID from $content field
Updating the Answer:You can use template_preprocess_node. in your theme template.php

function YourTheme_preprocess_node(&amp;$variables) {
  $variables['tags_tids'] = array();
  foreach ($$variables['field_tags'] as $key =&gt; $tag) {
    $variables['tags_tids'] = $tag['tid'];
  }
}


then in your node.tpl you could loop through the "$tags_tids"array, and do whatever you want.