They have a symbiotic relationship. The shrimp is reported to have bad eye sight and the goby stays near the shrimp to alert him/her of any apparent dangers. Likewise, the shrimp will protect the goby if need be, if something tries to come into their burrow.
They will come out of their hole together, and the goby is usually a tails length away from the shrimp. If someone or something gets to close to the tank it will rush the shrimp back into the hole to hiding.
I really like mine, they have great personality and very easy to care for. The smaller of the two loves to swim in front of the powerhead for long periods of time.
When I moved tanks this last time I took a bunch of rubble and laid it out on the bottom of the glass then filled sand in before I put my rocks in the tank. Even though the shrimp is small, it can easily cause rock to fall when it goes under it to burrow. Now theres tunnels all through the rock and at one of the entrances the shrimp has installed a door. Heres a picture of his doorway with a piece of rubble, its hard to see because of the glare and my lights arnt on. Look right in the center of the picture, thats his door: