This is a cool example of what you can do with the canvas element for HTML5. I used a canvas framework called KineticJS which allows multiple canvases to be placed on top of each other and animated individually to improve performance. I used a grid and a simple pathing algorithm to prevent overlap and randomly set the speed of each 'grain'. This project is currently featured on KineticJS's homepage.

You can set the number of grains in the URL query string.
eg: http://yuccaberry.com/projects/sandman/?num=500 will set 500 grains of sand.

Hover over the gray area to get it started. You can check out the code on github here.