The conversation you are talking about is recounted in The Gospel of John, Chapter 21.
The reason that Jesus asks Simon Peter this question three times is because Peter had betrayed him three times before Jesus was crucified. (Mark 14) By asking him the question three times, Jesus is both reminding Peter of what he had done and, perhaps, giving him a symbolic chance to affirm his love as many times as he had denied it.
Why formally, with the name of his father? I think this is to underline how seriously he means the question and, with it, the instruction to "feed my sheep."
John 21:15-17. I agree, Jesus was giving Peter the chance to redeem himself for the three denials, but...
When the Greek words were translated into our English New Testament, the meaning of each type of love Jesus was asking about was lost.
Definitions are taken from Vine's Expository Dictionary of New Testament words: "Agape and agapao are used in the NT
(a) to describe the attitude of God toward His Son, John_17:26; the human race, generally, John_3:16; Rom_5:8; and to such as believe on the Lord Jesus Christ, particularly, John_14:21;
(b) to convey His will to His children concerning their attitude one toward another, John_13:34, and toward all men, 1_Thess_3:12; 1_Cor_16:14; 2_Pet_1:7;
(c) to express the essential nature of God, 1_John_4:8.
Phileo is to be distinguished from agapao in this, that phileo more nearly represents "tender affection."
So, reading the text with the Greek words gives a clearer view of what Jesus was trying to convey to Peter.
15 So when they had finished breakfast, Jesus said to Simon Peter, "Simon, son of John, do you agapao Me more than these?" He said to Him, "Yes, Lord; You know that I phileo You." He said to him, "Tend My lambs."
16 He said to him again a second time, "Simon, son of John, do you agapao Me?" He said to Him, "Yes, Lord; You know that I phileo You." He said to him, "Shepherd My sheep."
17 He said to him the third time, "Simon, son of John, do you phileo Me?" Peter was grieved because He said to him the third time, "Do you love Me?" And he said to Him, "Lord, You know all things; You know that I phileo You." Jesus said to him, "Tend My sheep.