login_destination module and link with anchor
Try this.    

&lt;?php if ($comment_form): ?&gt;
        &lt;h2 class="title comment-form"&gt;&lt;?php l('Login or anonymous comment', user, array('query' =&gt; 'current=node/3#comments')); ?&gt;&lt;/h2&gt;
&lt;?php print $comment_form; ?&gt;