1. A method implemented at least in part by a computer, the method comprising: obtaining a grammar that defines a format for serializing an object, the grammar representing rules for serializing the object that preserve embedded objects and relationships in a serialized representation of the object, the grammar defining a header and a payload for serializing the object, the header including metadata for the grammar, the metadata usable in de-serializing objects serialized using the grammar, the grammar having rules for de-serializing the object based on a difference between a minor version of a serialization engine to serialize the object and a minor version of a de-serialization engine to de-serialize the object and a difference between a major version of the serialization engine to serialize the object and a major version of the de-serialization engine to de-serialize the object, the payload including an identifier of each descendent object of the object, the payload further including reference data for each reference, if any, included in the object, the reference data indicating relationships of the object, the reference data potentially referring to one or more of: an object type supported by a scripting environment in which the object resides, an object type supported by a host environment of the scripting environment, and a foreign object type that is defined outside of both the scripting environment and the host environment; and serializing the object into serialized data by executing code that implements the grammar.