A phase field approach for structural topology optimization which allows for topologychanges and multiple materials is analyzed. First order optimality conditions arerigorously derived and it is shown via formally matched asymptoticexpansions that these conditions converge to classical first order conditions obtained inthe context of shape calculus. We also discuss how to deal with triple junctions wheree.g. two materials and the void meet. Finally, we present severalnumerical results for mean compliance problems and a cost involving the least square errorto a target displacement.