Polystyrene foam is almost similar to plastic material which contain lots of small balls. Here we are going o create this material.
Make sure you are using Vray as your render engine. Open Material editor. Apply VRayMtl to one of the free sample slots. Name it as you wish. I chose Foam.
Add Cellular texture to the Diffuse map.
In Cellular Parameters, change Cell Color to RGB=240. Then change Both Division Colors to RGB=200. Reduce Size to 0.2. Size will define how big or small will be the foam balls. You can try different values. Change Spread value to 1.
Render your scene and see the result. Now you can see the size of the foam balls on your object.
In VrayMtl material, Copy the Cellular Diffuse map on Bump map slot. Make sure you are using Copy method. Increase Bump value to 100.
In the Bump Cellular map, change Cell Color to RGB=255. Change top Division Colors to RGB=128 and the bottom color to black(RGB=0).
Render your scene and see the result. There is one more step to make it more realistic. In VRayMtl parameters, Change Reflect color to RGB=200. Make sure Fresnel reflections is enabled. Change Fresnel IOR to 1.46. Reduce Refl. glossiness to 0.65.
Render your scene with final settings.