In Grand Cayman, I would definitely suggest booking the excursion on the ship, as much of the beach is owned by the resorts and hotels. Captain Marvin's did show a portion of the beach that seemed to be public, but it was many miles from the port, and there was not really anyone there and no amenities.
In Costa Maya, you can get to the small fishing village of Mahahual round trip for $5/person, a very nice beach but no amenities, so if you want amenities/drinks included, you may want to get that through the ship as well. And apparently, there is another beach resort close to the port, but I didn't see this, so I have no knowledge of that resort.
Something to keep in mind, when we were in Costa Maya, we were told that there was no such thing as a private beach, whereas in Grand Cayman, we were told (by the cruise director) that there was no such thing as a public beach.