Preheat the oven to 320F (160C). Spread the pistachios on a baking tray and roast for 10 minutes. Let them cool and chop.
Now make the syrup by combining the sugar, lemon juice, and water in a saucepan. Bring to the boil and cook for 10-15 minutes or until the syrup thickens. Set aside to cool.
Lightly brush the 9x13-inch baking pan with some of the melted butter. Unroll the filo pastry and take one sheet covering the rest with a damp tea towel to prevent from drying out.
Place half of the sheet in the pan and let the other half hang over the side. Lightly brush the pastry in the pan with the melted butter, fold the hanging half over, and brush once again with the butter. Repeat until you have used the half of the pastry.
Sprinkle the walnuts over the pastry. Now repeat the process of layering and brushing the pastry until you have used all the remaining pastry. Generously brush the top with the remaining butter. Refrigerate for 10 minutes.
With a sharp knife, cut the pastry to diamond-shaped pieces. Bake for 30 minutes or until golden. When done, drizzle the cold syrup over the hot pastry and sprinkle with the pistachios. Enjoy!