1. A method for measuring similarity between clustered data grammars, comprising: constructing at least a first grammar associated with a first device and a second grammar associated with a second device, wherein the first grammar and the second grammar each comprise a symbol sequence that re-expresses one or more sequenced data items and one or more rules that represent a repeated pattern in the symbol sequence; calculating one or more distance metrics that quantify a similarity between the first grammar and the second grammar according to a comparison between the one or more rules in the first grammar and the one or more rules in the second grammar; and determining a relationship between the first device and the second device according to the one or more distance metrics.