Rinse the lentils in a sieve under cold water. Add the lentils to a pan and cover with boiling water. Bring to the boil and simmer for 25 minutes until tender. Drain and leave aside.
Add the flour to a large bowl and add a pinch of salt. Make a dip in the middle and add the olive oil and water.
Mix the flour and oil/water together with a fork. The mixture will start to clump together. Use your hands to form the dough into a ball. Cover the bowl and leave the pastry dough to rest in the fridge.
Place a frying pan on a medium heat. Add a drizzle of olive oil and fry the onions for 3-4 minutes until starting to brown. Add the peppers and fry for another couple of minutes until starting to soften. Stir in the drained lentils.
Preheat the oven to 180 degrees (160 fan).
Flour a pastry board or worktop. Place the pastry on the floured surface and gently flatten it into a circle with your fingers. Then, using a floured rolling pin, roll the pastry into a circle to fit the base and sides of your tart tin.
Transfer the pastry to the tart tin. Push down into the corners and trim the top if necessary. Prick the base with a fork to stop the pastry from rising in the heat.
Bake the pastry case in the preheated oven for 10 minutes.
Crack the eggs into a bowl and whisk until mixed. Remove the pastry case from the oven and brush the bottom with a little of the beaten eggs. Return the pastry to the oven and cook for another 5 minutes.
Add the milk to the remaining beaten egg and season well. Whisk until thoroughly mixed.
Remove the tart case from the oven. Add the lentil mixture and sprinkle over the grated cheese if using. Pour over the egg custard.
Return the quiche to the oven and bake for 30 minutes until risen and golden.