You can use the same method than stackoverflow uses to link answsers: you provide in the url the id of the page, and the id of the specific answer (or comment, in your case). And your php script, when it sees this format of url, thansforms the url with an html anchor.
For example: http://yoursite/question_id/comment_id is redirected to site/question_id#comment_id
You can test it on this very answer by clicking this link: https://stackoverflow.com/a/10027770/311744.
This url provides enough information so that the server redirects to the correct page (the current page in this case), with the anchor to this answer (#10027770).
Then you can handle manually the special case where the comment is on the current page and prevent the reload of the same page with javascript (but I woudn't bother, and SO doesn't either)
Edit: What I understand is that you want to be able to click on "@5" written on a user comment, and this comment should somehow be displayed.
At this point you have two solutions:
- You redirect to the page where you can find the comment (and if this comment is on another page, you should load the page. This is what I explained before.
- You can just load the comment below the comment where the reference is, just like youtube does when you load reply to comments. (on this youtube page you have some top comments with replies that you can test)