It depends on what kind of beetle you have. For Dynastinids and things like that, male larvae have a small dot on their underside near the end of their body (third to last segment). I'm not sure about other Scarabaeids, and I think Lucanid females have a yellow "organ" at the end of their bodies.