Flexible word order
The difference is only that the words are in a different order. The grammar is the same. English actually has somewhat flexible word order, though we rarely exploit this in everyday conversation or prose.
The normal word order in English is SVO: subject-verb-object. That's the order of “John came along.” (There’s no object in that sentence; along is a particle, part of the phrasal verb “to come along”.)
But you can rearrange the words in many sentences and still make grammatical sense. One way to do that is to put the subject right after the verb, as in “Along came John.” There are other ways, too.
Famous examples
Here are some more examples, all of them famous:
Able was I, ere I saw Elba. (A famous palindrome.)
= “I was able ere [before] I saw Elba.” (Meaning: I, Napoleon, had power before I was exiled to the island of Elba.)
He called for his pipe, and he called for his bowl, and he called for his fiddlers three.
(From Old King Cole, a nursery rhyme.)
= “…and he called for his three fiddlers.” The purpose of putting the adjective after the noun is to rhyme with an earlier line in the poem, which also has unusual word order.
We three kings of Orient are. (Christmas carol, John Henry Hopkins, 1820–1891.)
= “We are three kings of Orient.” (That is, we are three kings from the East.)
My mind to me a kingdom is. (Sir Edward Dyer, 1543–1607.)
= “To me, my mind is a kingdom.”
But why?
As you can see from the examples above, one use of unusual word order is to fit the constraints of poetry or word-play.
More often, unusual word order indicates that something is special or important, thus deserving the emphasis and attention that comes from using words in an unexpected way. When someone says “Along came John”, they mean that John came along unexpectedly, and this was a wonderful or perhaps terrible event.
For example (not famous; I'm just making this up now):
In the orchestra pit holding a baton stood my son.
= “My son stood holding a baton in the orchestra pit.” A parent might use reversed word order to proudly describe seeing their son conducting an orchestra for the first time. The ordinary word order feels too dull and prosaic to describe such a momentous event.
This example illustrates another important use of unusual word ordering: to put the words in the order in which you want the listener to think about or imagine their meanings, when this is not the same as the normal order. The sentence above leads the listener to first imagine an orchestra pit, then some unidentified person holding a baton (therefore the conductor), and finally it is revealed that the conductor is the speaker’s son.
Often, a word gets strongest emphasis by appearing last, especially if it’s a noun. Mentioning the son last emphasizes the son, and mentioning John last emphasizes John.
Finally, unusual word ordering can sometimes create nice rhythms. The sentence about “my son” has a pleasing rhythm: it contains three “feet” of equal duration, each starting and ending with a stressed syllable: “orchestra pit”, “holding a baton”, “stood my son”. The prosaic version has a disorganized rhythm, like most prose. Ending on a stressed syllable often gives a sentence extra “punch”.
But how?
It takes “an ear for the language” to know when you can say words out of order and still be understood, and to predict what kind of poetic effect it will have. Part of the way you develop an ear for the language is by becoming familiar with well-known examples of unusual word order and poetic expression. They not only make you familiar with ways to “stretch” the language, they’re phrases that you can expect most English speakers to have heard, so your own unusual phrasings will echo the familiar ones in listener’s minds, helping them to follow the syntax.
It would be helpful to add some example sentences that are causing confusion, as you mentioned you checked some. – user3169 – 2014-12-29T06:14:42.347
@F.E. Does “inversion” usually cover reversed word order for rhetorical effect or just inversion as a grammatical device, as in questions, negation, and commands? – Ben Kovitz – 2014-12-29T08:04:06.667
@BenKovitz On ELL, I think there's only the one "inversion" tag. And so, I use it to cover all forms of subject-dependent inversions, which include: subject-auxiliary inversion due to any grammatical or rhetorical cause, and subject-complement inversion due to any grammatical or rhetorical cause, etc. (I'm hesitant to add too many new tags for specialization purposes, as that might get out of hand and/or be misused, considering that this is ELL with many learners and different grammar books. Though, perhaps a small number of new ones related to inversion might be doable. imo.) – F.E. – 2014-12-29T21:53:19.027
And of course, there's Little Miss Muffet by Mother Goose: Little Miss Muffet, Sat on a tuffet, Eating her curds and whey; Along came a spider, Who sat down beside her, And frightened Miss Muffet away. -- Which sounds much better than if it had used "A spider came along". – F.E. – 2014-12-30T18:53:46.777
@F.E. Having a single inversion tag sounds good. I just added some description to the tag wiki that ought to remove all doubt about whether inversion is just for grammar. See what you think. – Ben Kovitz – 2014-12-31T01:15:12.223
@F.E. Indeed, I suspect that the idea that along came can only mean “entering your field of view” results mainly from the influence of this nursery rhyme (multiplied by thousands of echoes and allusions, including some movies and songs). – Ben Kovitz – 2014-12-31T01:16:52.507
@BenKovitz The tag description looks good! :) – F.E. – 2014-12-31T02:26:21.260
2@BenKovitz As to the inverted construction "Along came NP", I'm not completely sure about its status. It might be a mere inversion, or it might be an inversion where for some of its meanings it is similar to "Here comes the bus!" in that it cannot be used in a non-inverted form with the same meaning, or perhaps it might be more of a hybrid, which might have an unclear status. Maybe it's idiomatic or an idiom, maybe it's a mere inversion, similar to "In came Kim", "Up went the balloon", etc. Be interesting to see an answer post on that, if possible. – F.E. – 2014-12-31T02:40:32.643