I've heard a lot of pastor's use John 21:7-19 to criticize Peter because he will not answer Jesus' question about whether he agapaw (loves) him, but instead only says that he philew (loves) him. They define agapaw as being a 'better' kind of love than the love of philew. Although this is a plausible scenario I do not believe that it is either an accurate view of the two words or (more importantly for this blog) accurate in the light of John 18.
First, the word differences in the Greek are probably closer to being synonymous than not. This is likely the case for 2 reasons: First, John has a habit of using similar words throughout his gospel that act synonymous to each other. Second, the word agape in John (it seems like the other gospels too) is only used in two ways vis-a-vis Jesus: i) in the mouth of Jesus or ii) the narrator talking about Jesus (and once about God the Father). Therefore it would be odd if John broke what seems to be something of a staple through out all the gospels. For more information you can check out BDAG's article on apapaw and philew.
John 18 is the backdrop to 21:7-19. Jesus is brought to the High Priest in order to be questioned, but the narrator shifts his attention for a moment from Jesus to Peter and another unnamed disciple (John?). Here is the well-known passage of Peter denying Jesus three times:
The other disciple, who was known to the high priest, came back, spoke to the servant girl on duty there and brought Peter in. “You aren’t one of this man’s disciples too, are you?” she asked Peter. He replied, “I am not.” It was cold, and the servants and officials stood around a fire they had made to keep warm. Peter also was standing with them, warming himself ... Meanwhile, Simon Peter was still standing there warming himself. So they asked him, “You aren’t one of his disciples too, are you?” He denied it, saying, “I am not.” One of the high priest’s servants, a relative of the man whose ear Peter had cut off, challenged him, “Didn’t I see you with him in the garden?” Again Peter denied it, and at that moment a rooster began to crow.The verses are self explanatory: Peter, another disciple and other servants and onlookers are around a fire, then people start recognizing Peter and begin to question him, "Aren't you with him?" Peter denies he has anything to do with Jesus.
In chapter 21 it is no coincidence that the narrator shapes the story so that Peter finds himself in a very similar setting: Around a fire with Jesus and others as witnesses (possibly even the disciple who was with him in chapter 18) and Jesus questioning him three times, "Do you love me?" (or "Are you with me?"). Jesus is not asking Peter the same question because Peter is answering the question incorrectly (i.e. philew), he is asking Peter three times because around another fire, with others present he denied Him three times. This is Jesus reinstating Peter into relationship with Him, He is letting Peter know that He has not rejected him.
I think the leadership implications of these two sections are rather important - and seldom adopted by the Church - but that is for another blog.
edit: Changed a sentence for clarity and to avoid heresy - oops.