The grey link button takes you to the comment in the same instance as you are currently using.
The rainbow pentagon button takes you to the comment in the hosting instance (which may be the same if you're browsing a local community).
I don't know many situations where one would actually click on them—maybe the latter is useful if you're worried that federation is being slow and you're not seeing votes or replies through your local instance. But the two links can be useful to copy (by right-clicking, or long-pressing, or whatever you do to copy links in your browser/app), the former if you want to show somebody else what a comment looks like through your home instance and the latter if you want to link to a post/comment normally.
It opens the item (post, comment) in the instance that it was created on. For example I'm on https://sh.itjust.works so if I click on that button of your post it opens this post on https://lemmy.world, which is your instance.