It's all genetic. Here is a list of the taxonomies of several common curcurbits:
Watermelon:
- Kingdom: Plantae
- Phylum: Magnoliophyta
- Class: Magnoliopsida
- Order: Violales
- Family: Curcurbitaceae
- Genus: Citrullus
- Species: lanatus
Squash:
- Kingdom: Plantae
- Phylum: Magnoliophyta
- Class:: Magnoliopsida
- Order: Violales
- Family: Curcurbitaceae
- Genus: Curcurbita
- Species: Pumpkin: maxima, Butternut type: moschata, Summer type: pepo
Cucumber + Melon:
- Kingdom: Plantae
- Phylum: Magnoliophyta
- Class: Magnoliopsida
- Order: Violales
- Family: Curcurbitaceae
- Genus: Cucumis
- Species: Cucumber: sativus, Melon: melo
As you can see, the watermelon, squash, and melon are in the same family, But each has it's own Genus. Of course, every species of plant has its own set of characteristics. Watermelon vines are thinner and longer than squash vines, and the leaves are deeply lobed, compared with the squashes wide, flat leaves.
The fruit looks very similar when young, but when they are matured the watermelons have a dramatic decrease in starch content, and have low density flesh with extremely high moisture content, and a high level of fructose. The cucumber genus is lower in water content, but also store the energy supply as fructose rather than starch. The melons have more sugar than the cucumbers.
Notice that the ones with the higher starch ripen latest in the season, when animals need starch to build up fat for winter. The more sugary juicier fruits are ripened a little earlier, when the animals need quick energy.