here, sentences 1, 3, and 5 are literal. They contain word-by-word or usual meanings.But in sentences 2, 4 and 6 the comparisons are figurative: John's strength is compared to that of an ox; Mary is compared to a nightingale; and the sun is given a human Quality.
To achieve figurative language, the devices called figures of speech are used. Some of the most common figures of speech are simile, metaphor, and personification.