In the sections leading up to that claim Carnap discusses a first class of what he calls 'pseudo-statements', which are all sentences characterized by having in them some 'meaningless' word. The sentence "kjdfho is great" is a pseudo-statement of that first class, because it includes the presumably meaningless expression 'kjdfho'. Then, in §4 Carnap turns his attention to a second class of 'pseudo-statements', which includes sentences that while grammatically meaningful, are still not acceptable. As examples he considers the following ungrammatical sentence (1) and the grammatical sentence (2):
(1) Caesar is and;
(2) Caesar is a prime number.
The problem with (1) is obvious: it's not a well-formed (or grammatical) sentence. The assumption here is that 'and' is an operator on sentences, so its placement in (1), in an NP position, takes us out of the set of grammatical sentences of English. From the logico-semantical point of view, (1) is as ungrammatical as the aforementioned "kjdfho" sentence, and thus belongs to the first class of 'pseudo-sentences'. The problem with (2), however, is not that it's not well-formed. 'Caesar' is a grammatically acceptable name of an individual, and 'is a prime number' is an acceptable predicate expression. Nevertheless, Carnap claims that (2) is meaningless, and gives the following explanation:
"Prime number" is a predicate of numbers; it can be neither affirmed nor denied of a person (p. 68).
Although he doesn't state it explicitly in those terms, the idea here is that while sentence (2) is a well-formed sentence, it is not a well-typed one. If we were working with a formalized fragment of English, we would define an alphabet of the usual latin letters and then specify grammatical rules for generating a subset Wff of the well-formed sentences of English. Among those sentences we could find (2) and we wouldn't find (1). Of course, all these matters would depend on the expressive power of our formalized fragment. But suppose it's powerful enough to grant (2) the status of a well-formed sentence. Then, we would specify an extra layer of typing rules for generating the subset Wtf ⊆ Wff of well-typed sentences of our fragment. The point of typing rules is to ensure that the functional expressions of our language such as predicate expressions ('is prime') and functors ('father') are combined with expressions of a type compatible with the domains of definition of those functional expressions. To see how (2) is not well-typed, let's look at the domain of definition of 'is prime':
(T) prime : Nat → Bool.
The function prime, which is the referent of 'is prime' or 'is a prime number' is defined only for natural numbers and according to the known rule, maps natural numbers to true or false, depending on their primality. Consider the expression:
(3) π is a prime number.
Is (3) well-typed? Since π is not a natural number, (3) is not a well-typed expression. It may be a well-formed numerical expression according to a rule that says that a unary numerical function (e.g. prime) applied to a numerical expression (e.g. π) yields another numerical expression (e.g. 3). But it's nevertheless not well-typed because the domain of definition of prime doesn't include non-natural numbers in it (see T above).
After the realization that (3) is not well-typed, the non-well-typedness of (2) shouldn't be surprizing. 'Caesar' is not a numerical expression, so it's certainly not an expression that has a value in natural numbers. Now, that's a reason to regard (2) as not well-typed. The general question that arises here is whether we should consider not well-typed sentences as 'pseudo-sentences', as Carnap there does. Type-restrictions can be a helpful device for checking the correctness all sorts of mathematical constructions, so well-typedness is certainly an incredibly useful notion, but whether it should be grounds for partitioning the set of well-formed sentences of a given language into acceptable and unacceptable ones might be an interesting topic for another discussion.
References
Ayer, A.J. (1959) Logical Positivism.
Carnap, R. (1953) "The Elimination of Metaphysics Through Logical Analysis of Language", Ayer 1959.
Cumming, S. (2014) λ–Calculus and Type Theory, Lecture Course (Winter), UCLA.