This one's funny, because it sounds like grammar, or maybe computer programming...
Syntax is the study of how sentences are put together. Part of this is word order. This is the one everyone fears because it often involves diagramming sentences. Actually, one of my most intense and wonderful classes was Syntax 1 at UC Santa Cruz. We put together a set of rules for how to create the sentences of English, based entirely on example sentences given to us by our teacher, Professor Sandy Chung (who totally rocks, by the way). Each time we thought we had it, she'd throw us another sentence that didn't fit, and the rule set evolved.
So how is this useful for science fiction and fantasy writers?
First, consider Yoda. He doesn't use typical English syntax. We know this. Yet we can still understand him. I always figured he was a native speaker of some other language and that affected how he could speak the common tongue - but my husband says he never thought of that, and he thought Yoda was just quirky.
Be that as it may, one of the things you can do by altering syntax is give a feeling of dialect, or of a foreign accent. The key here is to keep it all consistent. If it's inconsistent it will feel quirky, and could be construed as an error.
So how do you keep it consistent? Track your subject/verb/object order, and track your phrase types.
In English we use SVO (subject-verb-object) word order: I hit him: I=S, hit=V, him=O.
In Japanese they use SOV (subject-object-verb) word order. boku ga kare o utta : boku=I (for boys)=S, kare=he=O, utta=hit=V
I don't personally know any VSO languages (write in a comment if you do!) but I do know that Earth languages don't actually have all the possible orderings of these elements. For alien languages, who knows? They might not even conceptualize subject and object and verb the way we do - in which case it might be tough to write out their language in the story!
Some languages have freer word order than English. Take for example Latin or Japanese. This is a place where phrase syntax (in the Japanese case) or morphology (in the Latin case) can allow you greater freedom.
In Japanese, the subject and object are marked by particles, special words that come directly after the nouns they apply to and tell you their role in the sentence. With your words marked like that, you can scramble the phrases up a bit and still get meaning out of it.
In Latin, morphology provides case suffixes. Case suffixes essentially play the same role as the Japanese particles, and by labeling the word's role directly, allow more freedom for altering word order.
Play around with it. Yoda shows us that we can understand a lot of different ways of putting a sentence together, provided that we know enough to track each noun's role in the action at hand. You might also want to run it by your friends to make sure it's comprehensible!
At this point you may notice that I've been talking about altering English syntax within a story to imply the structure of another language. This is true. The same principles apply if you want to write sentences in a created language - but I'm guessing this is going to happen less often in the story than the use of English for implication. I have written a song in one of my created languages, but I don't imagine it will do more than sit in an appendix, since putting the entire thing in the story as Tolkien did isn't quite my style.
Now, go forth and have fun with syntax!