Nearly every part of a crab is edible, with one exception: The lungs, also known as the gills. While they aren't inherently toxic, they just don't taste very good.
Beyond the fact that the gills tend to contain higher levels of heavy metals, they are tough and chewy, with a bitter flavor that no amount of seasoning can improve.
You're not missing out on much of the crab's lean protein content if you skip the lungs, either, since they're made mostly out of chitin, or the same material as the crab's shell.