The cup that Jesus mentions is a metaphor for his Passion — the trial and death that he is soon to undergo. Here the word ‘passion’ takes its meaning from the Latin ‘pati,’ to suffer or endure, especially with patience. And for him to drink of that cup, down to the dregs, is to submit to the will of the Father, and to accomplish his purpose, his redemptive work.
Hence, his final words from the cross: “It is accomplished.”