let me try to oversimplify without referencing the article. a palace is where royalty lives, focus on luxury. it is guarded, but not very much. a fort is for military purposes, it is heavily guarded and armed and serves as a defensive post. the number of forts depends on the territory and landscape. a castle is a palace with fort like features, the focus is on safekeeping of the royalty, luxury comes second. so basically a combination of the 2.
In car terms, a palace is a Rolls Royce, a fort is a Ferrari, and a castle is a Bmw/ Mercedes or Aston Martin.
P.s. just read the article after posting this comment, and wow.
Here you can read about the difference:
Also, in languages I speak (most not presented on DL) there are two separate words for the two notions. The difference must be of importance, at least must have been, at some point :)