The ghost of Hamlet's father says,
My hour is almost come
When I to sulfurous and tormenting flames
Must render up myself.
Here, the ghost substitutes the word "hour" to refer to time, using a figure of speech called metonymy. Metonymy occurs when a writer substitutes a detail associated with a thing for the thing itself. An hour is a measurement of time, and so we understand what the ghost means when he says that his "hour" to return to Purgatory is near.
Later, the ghost says to Hamlet that, if he could tell his son about Purgatory, the tale
Would harrow up thy soul, freeze thy young blood
Make thy two eyes, like stars, start from their spheres
Thy knotted and combined locks to part
And each particular hair to stand on end,
Like quills upon the fearful porpentine.
But this eternal blazon must not be
To ears of flesh and blood.
In this passage, the ghost uses a metaphor comparing Hamlet's soul to land that has been plowed and broken up (harrow can also mean to cause distress to, but not typically with the word "up"), conveying the idea that the story of Purgatory would be so awful that it would tear up Hamlet's soul. Further, the ghost says that the tale would freeze his blood; now, it wouldn't actually freeze Hamlet's blood, but it would make Hamlet feel very frightened. Therefore, he's created another example of metonymy, using the idea of blood running cold to stand in for simply saying that it would be frightening (consider that the expression, "My blood ran cold," means to be scared). Further, Hamlet's blood, in isolation, is not young; it is his whole self that is young, and so this is an example of synecdoche (when a part of something stands in for the whole thing).
Next, the ghost uses a simile to compare Hamlet's eyes to two stars; he means that they would come out of their sockets as stars that shoot across the sky. Next, another simile compares Hamlet's hair to the quills of a porcupine because his individual hairs would seem to separate from each other and then stand straight up. Finally, he says that people with "ears of flesh and blood" are not meant to hear about Purgatory; this is another example of synecdoche: flesh and blood are part of what makes up the whole human ear.