Actually, it’s a colloidal solution, which is solid particles suspended in a liquid. That’s why it can flow like a liquid and take the shape of it’s container, but if you put pressure on it, all the solid parts lock together and it starts behaving like a solid. I think it does this because of the shapes of the solid parts. They’re sharp rather than smooth, so they lock together under pressure rather than just rolling past each other.
Ah it depends on whether you mean custard in custard tarts. Because that’s more like a solid than a liquid! The proteins in the egg stick to one another and make a sort of lattice with water trapped inside.