As Zhaph - Ben Duguid said, there is the .LXFML format which is basically an XML document detailing a LEGO model. Another format you might find of use if the .ldr format. .ldr files are used in various LEGO virtual building programs that make up what's called the LDraw system of tools. As an example of the .ldr format, this:

Can be generated by pasting this into a text document and renaming it .ldr:
0 Brick test
0 Name: Brick test.ldr
0 Author: HaydenStudios
0 Unofficial Model
0 ROTATION CENTER 0 0 0 1 "Custom"
0 ROTATION CONFIG 0 0
1 4 50 0 0 1 0 0 0 1 0 0 0 1 3001.dat
1 7 50 -8 0 1 0 0 0 1 0 0 0 1 3020.dat
1 4 50 -32 0 1 0 0 0 1 0 0 0 1 3003.dat
1 4 50 -56 10 1 0 0 0 1 0 0 0 1 3009.dat
0
All LDraw applications rely on having a base LDraw installation to refer to which contains files for 3D models of all LEGO parts available in the LDraw parts library. If you wanted to write a Javascript that interprets LDraw models, you'd need it to have an LDraw parts library stored somewhere to refer to, such as on a server.
Each tool in the LDraw system of tools has its own "actions" that it injects into an LDraw file when you edit it. One such program, LPub, is specifically designed for making instructions for models constructed using any LDraw-compatible tool:

It allows you to set up each page, and saves your setups for each page into the LDraw file so that it can be read by any program that knows how to read LDraw files and LPub's formatting.
This and the .LXFML format are the only two file formats I know of that are along the lines of what you described. One potentially deciding factor in which format to choose is the different ways they handle instructions. For LDraw files, you have to manually make the steps as you make the models, whereas LDD automatically generates the instructions. While this can save the builder a lot of time, the order in which the pieces are added may not make as much sense as if they were made manually. Whether this is a pro or con is really a matter of personal preference.
Altogether, though, I'd personally recommend using LDraw files due to LEGO Digital Designer's relatively limited part library, as well as the fact that the former is generally more favored among the late teen and AFOL community.