The reason some fish can take different salinities has to do with evolution. Fish probably evolved in fresh water. They believe this because all fish have a flap of skin in the throat that prevents them from swallowing water. This is for preventing the fish from being flooded with water, freshwater fish osmosis says that the body is constantly being filled with water (because their bodies have more salt then the surrounding water) so the kidneys have to regulate the content of salt and produce lots of urine to eliminate it. Salt water fish have the flap of skin, but the opposite problem, their bodies are being dehydrated because the salinity is higher in the ocean then their bodies. They are constantly drinking and their kidneys remove salts, but they produce very little urine. Fish that have the ability to change the function of the kidneys can be kept in various salinities, thus can be adapted to fresh or salt or anything in between.