query grandchildren taxonomy terms

Try to use child_of at your second foreach, see the documentation.

child_of

(integer) Get all descendents of this term. Default is 0. Note: the difference between child_of and parent is that where parent only gets direct children of the parent term (ie: 1 level down), child_of gets all descendants (as many levels as are available)

So in your case your second foreach will look like this:

<?php foreach( get_terms( 'wpsc_product_category', array( 'hide_empty' => false, 'child_of' => $parent_term->term_id ) ) as $child_term ) { ?>

You can use the returning value parent in a conditional statement to detect on what “level” the term is. Of course you can do this also with one foreach.