I'm attempting to return the greatest term taxonomy id of the publish page or perhaps a taxonomy page.

I had been sucessful at listing all taxonomy id's such as this:

  <?php
$terms = get_the_terms( $post->ID , 'mytaxonomy' );
if($terms) {
    foreach( $terms as $term ) {
        echo $term->term_taxonomy_id;
    }
}
?>

This is exactly what I'm attempting to do (return just the greatest ID) (does not work):

   <?php
$terms = get_the_terms( $post->ID , 'mytaxonomy' );
if($terms) {

foreach( $terms as $term ) {
    echo max( '$term->term_taxonomy_id');
    }

}
?>

Help :)

NOTE: My primary goal is to make this happen: http://wordpress.stackexchange.com/questions/9562/multi-level-taxonomy-navigation

The max function can most likely compare only two terms at any given time. Keep an eye on the utmost term along the way with the loop - maybe:

maximum_term = max(maximum_term,term->term_taxonomy_id)

You don't need to make use of the loop whatsoever just apply max towards the $terms variable