Recently, @naruto mentioned the phrase 頭が赤い魚を食べた猫, which can be understood in many ways. There is some ambiguity in how each word relates to each other.
Among other possibilities, it could mean
- [(頭が赤い)魚]を食べた猫 (red-headed fish)
- [(頭が赤い)+(魚を食べた)]猫 (red-headed cat)
The same applies here. Consider the following pattern:
AとBとCのD
As far as logic and grammar is concerned, this can be interpreted as either one of these possibilities:
- (AとBとC)のD
- (AとB)と(CのD)
- Aと[(BとC)のD]
Note that A, B, C, and D can be nouns or noun phrases. If the latter, it could get even more confusing, so I won't consider this case.
Usually context resolves the ambiguity and makes it obvious. For the example you gave, that would be possibility (3): the difference between certain kinds of vegetables.
To illustrate the point, let me give some examples for each possibility.
(《》
markers added by me for clarity)
①:
- 《せりとレタスとキャベツ》の違い
- 《ブランデーと梅酒と柑橘【かんきつ】ジャム》の大人[珈琲]【コーヒー】
- garden COLORING BOOK 《小鳥と花と動物》のぬり絵
- 《君と彼女と彼女》の恋
②:
- 勇者と少女と《変化の指輪》
- 「使命」と「運命」と「人生の意味」
- 僕と君と《夜空の星》
- 星杯騎士団【グラールリッター】と七耀教会【しちようきょうかい】と《黒【くろ】の史書【ししょ】》
- コナンと平次【へいじ】と《恋の暗号》
③:
Note the first sentence.
- [ポスドク]【postdoctor(al)】問題と《アメリカと日本の違い》
- 下妻物語【しもつまものがたり】と《ウルルと森の物語》
- 竹取物語【たけとりものがたり】と《伊邪那岐命【いざなぎのみこと】の伊邪那美命【いざなみのみこと】の物語》
- 《伊邪那岐命【イザナギノミコト】と伊邪那美命【イザナミノミコト】の夫婦神》と《伊邪那岐命と伊邪那美命の争いを仲裁した菊理媛大神【ククリヒメノオオカミ】》が祀られている
- 和風レシピと《梅酒と梅干しの作り方》
I had a hard time coming up with examples for case ③, but it's definitely possible.
To summarize, only context and common sense can tell you what の applies to, it depends on what the nouns or noun phrases A, B, C, and D are.
Lastly, if you really wanted to leave no ambiguity, you could resort to a lengthy phrase that says it explicitly, such as せりとレタスとキャベツという3つの(野菜・植物)の違い.