In a saucepan over medium-low heat, combine the sugar, water, and pistachios. Whisk until the sugar dissolves.
Bring the mixture to a simmer, and cook for 2 minutes. Turn off the heat and set the saucepan aside until the mixture has cooled completely.
Strain the mixture through a fine-mesh sieve to remove the pistachios. Stir in the almond extract. You can keep the syrup in a sealed container in the fridge for about a week.
In a mug, combine the espresso and syrup and stir together.
Pour in the steamed milk. Sprinkle with chopped pistachios, if desired. Serve immediately!
