In Shakespeare's Hamlet, the ghost of Hamlet's father appears within three minutes of the beginning of the play and enters once again shortly before the end of the same scene. The ghost appears to several characters, including Marcellus, Bernardo, and Horatio, and in a later scene in the first act, it also appears to Hamlet. The ghost refuses to talk to anyone by Hamlet, which creates mystery and anticipation about the ghost for the audience and emphasizes what the ghost says when it finally speaks to Hamlet.
The timing of the ghost's entrance is a strong indication of its importance in the play. The ghost provides exposition and gives Hamlet information that moves the play forward, even though Hamlet seems reluctant to act on the information and later doubts that the ghost is truly his father's spirit.
HAMLET. ... The spirit that I have seen
May be a devil; and the devil hath power
T' assume a pleasing shape; yea, and perhaps
Out of my weakness and my melancholy,
As he is very potent with such spirits,
Abuses me to damn me....(2.2.593-598)
The ghost reappears in the scene between Hamlet and his mother (act 3, scene 4)—although, oddly, she can't see it, even though it appears to the castle guards, Horatio, and Hamlet—and it urges Hamlet to focus on his vow to avenge his father's death.
GHOST. Do not forget. This visitation
Is but to whet thy almost blunted purpose. (3.4.121-122)
In Macbeth, Banquo's ghost doesn't appear until act 3, scene 4, well past the midpoint of the play and well past the point in the play where the plot has been set in motion. Banquo's ghost is seen by no one except Macbeth, and it says nothing to anyone.
The appearance of Banquo's ghost has no effect on the plot. It's never mentioned again by any character other than Macbeth, who mentions it only once in the "apparition scene," act 4, scene 1. (The "apparitions," if considered ghosts, have considerably more influence on Macbeth than does Banquo's ghost.)
Whereas the ghost of Hamlet's father seeks a vow from Hamlet to avenge his father's death, Banquo's ghost doesn't prompt Macbeth to do anything, except react in horror, and there seems to be little residual effect of its appearance on Macbeth.
The ghost serves to show Macbeth's fragile mental and emotional state, but by now, this should be fairly evident to the audience and most of the other characters in the play, particularly Lady Macbeth.
Interestingly, Lady Macbeth never asks Macbeth what he sees that he says "might appall the devil" (3.4.72), and he never tells her who or what it is. Does she see the ghost, too, or does she simply assume that Macbeth is hallucinating?
The ghost of Hamlet's father is undoubtedly "real," which is to say that it's seen by Hamlet and others (except Hamlet's mother, for some unexplained reason), but there's some question as to the "reality" of Banquo's ghost.
Nobody sees Banquo's ghost but Macbeth, a man in a precarious mental state who has already shown that he's prone to having hallucinations, like when he sees a dagger floating in the air (2.1.41-71) and hears voices after he murders Duncan (2.2.46-55). And here is Macbeth again, seeing a ghost after he's had another person murdered.