Metaphors and similes both compare one thing to another to make a point.
The simile here compares Robert to a grumpy bear in the mornings.
Robert is like a grumpy bear when he gets out of bed.
The metaphor states that Robert is a grumpy bear in the mornings, making the comparison more powerful.
Robert is a grumpy bear when he gets out of bed.